package com.itcat.api;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.itcat.api.mysql.UmsResourceCategoryApi;
import com.itcat.mapper.UmsResourceCategoryMapper;
import com.itcat.mysql.pojo.UmsResourceCategory;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

/**
 * [一句话描述该类的功能]
 *
 * @author : [Cr Mr]
 * @version : [v1.0]
 * @date : [2022/4/3 20:21]
 */
@DubboService
public class UmsResourceCategoryApiImpl implements UmsResourceCategoryApi {

    @Autowired
    private UmsResourceCategoryMapper mapper;

    /***
     * 查询所有后台资源分类
     * @author Cr Mr
     * @date 2022/4/4 10:49
     */
    @Override
    public List<UmsResourceCategory> listAll() {
        return mapper.selectList(new LambdaQueryWrapper<UmsResourceCategory>());
    }

    /***
     * 添加后台资源分类
     * @author Cr Mr
     * @date 2022/4/4 10:49
     */
    @Override
    public void create(UmsResourceCategory umsResourceCategory) {
        mapper.insert(umsResourceCategory);
    }

    /***
     * 修改后台资源分类
     * @author Cr Mr
     * @date 2022/4/4 10:54
     */
    @Override
    public void update(Long id, UmsResourceCategory umsResourceCategory) {
        umsResourceCategory.setId(id);
        mapper.updateById(umsResourceCategory);
    }

    /***
     * 根据ID删除后台资源
     * @author Cr Mr
     * @date 2022/4/4 10:54
     */
    @Override
    public void delete(Long id) {
        mapper.deleteById(id);
    }


}
